package com.le.sarrs.web.model;

import java.lang.reflect.Field;

/***
 * 地域相关参数
 *
 * @author gaojiawei
 */
public class Location {

    private String userSettingCountry;

    private String salesArea;

    private String clientIp;

    private String region;

    public String getUserSettingCountry() {
        return userSettingCountry;
    }

    public void setUserSettingCountry(String userSettingCountry) {
        this.userSettingCountry = userSettingCountry;
    }

    public String getSalesArea() {
        return salesArea;
    }

    public void setSalesArea(String salesArea) {
        this.salesArea = salesArea;
    }

    public String getClientIp() {
        return clientIp;
    }

    public void setClientIp(String clientIp) {
        this.clientIp = clientIp;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String toString() {
        Field[] fields = this.getClass().getDeclaredFields();
        StringBuffer sb = new StringBuffer();
        for (Field f : fields) {
            try {
                sb.append(f.getName())
                        .append("=")
                        .append(f.get(this))
                        .append("&");
            } catch (IllegalArgumentException e) {
                sb.append("&");
            } catch (IllegalAccessException e) {
                sb.append("&");
            }

        }

        return sb.toString();
    }


    public static void main(String[] args) {

        Location location = new Location();
        location.setClientIp("127.0.0.1");
        location.setRegion("zh");
        System.out.println(location);
    }
}
